#include "RouteManager.h"

void RouteManager(const char *routePathConfig) {
    string routePath = string(routePathConfig);
    printf("[INFO] 请输入要添加的URL，结尾不能为/\n");
    string url;
    getline(cin, url);
    printf("[INFO] 请输入控制器名\n");
    string controllerName;
    getline(cin, controllerName);
    FILE *f = fopen(routePath.c_str(), "a");
    if (f == nullptr) {
        printf("[ERROR] 路由文件不存在\n");
        return;
    }
    fprintf(f, "%s %s\n", url.c_str(), controllerName.c_str());
    fclose(f);
}
